﻿using System;
using System.Diagnostics;

namespace Forex.IB.RealTimeBars.WinApp.Extensions
{
   [DebuggerStepThrough]
   public static class LongExtensions
   {
      private static readonly DateTime 
         NineteenSeventyUtc = new DateTime(1970, 1, 1, 0, 0, 0);

      public static DateTime ToLocalDateTimeFromSecondsSince1970Utc(
         this long secondsSince1970Utc)
      {
         secondsSince1970Utc.MustBeGreaterThanOrEqualTo(0);

         DateTime dateTime = NineteenSeventyUtc.AddSeconds(secondsSince1970Utc).ToLocalTime();
         return dateTime;
      }
   }
}
